﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataOperation;
using System.Data;

namespace ConsoleTest
{
    class Program
    {
        static void Main(string[] args)
        {
            DataTable dt = new DataTable();
            DataColumn col;
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "ID";
            dt.Columns.Add(col);
            col = new DataColumn();
            col.DataType = System.Type.GetType("System.String");
            col.ColumnName = "Name";
            dt.Columns.Add(col);
            for (var i = 0; i < 10; i++)
            {
                DataRow row;
                row = dt.NewRow();
                row["ID"] = i.ToString();
                row["Name"] = i + "william";
                dt.Rows.Add(row);
            }

            ExcelOperation.SaveDataTableToExcel(dt, @"D:\Test\Excel\test.xlsx");

            Console.WriteLine("Well Done!!");

            DataTable ds = ExcelOperation.LoadDataFromExcel(@"D:\Test\Excel\test.xlsx", "Sheet1");
            foreach (DataRow item in ds.Rows)
            {
                foreach (DataColumn col1 in ds.Columns)
                {
                    Console.WriteLine(item[col1]);
                }
            }

            ExcelOperation.makeChart(@"D:\Test\Excel\test1.xlsx");

            Console.Read();

            
        }
    }
}
